package cscie160.hw6;
/**
 * This class manages the simplest demo operations with the ATM on client side.
 */

public class Client
{

    private static final String clntRep = "Client. ";
    /**
     * main method to collect command line input parameters and launch the operations.
     * @param args String[]
    */ 
    public static void main(String[] args)
    {

        try 
        {
            // parse command line arguments

            String host = args[0];

            int port = Integer.parseInt(args[1]);

            ATM atm = new ATMProxy(host, port);

            // get initial account balance

            System.out.println(clntRep + "Balance: "+atm.getBalance());


            // make $1000 deposit and get new balance
    
        System.out.println(clntRep + " Depositing: 1000");

            atm.deposit(1000);

            System.out.println(clntRep + "Balance: "+atm.getBalance());


            // make $250 withdrawal and get new balance

            System.out.println(clntRep +" Withdrawing: 250");

            atm.withdraw(250);

            System.out.println(clntRep + "Balance: "+atm.getBalance());


            // make $750 withdrawal and get new balance

            System.out.println(clntRep + " Withdrawing: 750");

            atm.withdraw(750);
            System.out.println(clntRep + "Balance: "+atm.getBalance());


            // make $200 deposit and get new balance
            System.out.println(clntRep + " Depositing: 200");

            atm.deposit(200);

            System.out.println(clntRep + "Balance: "+atm.getBalance());

        }
        catch (Exception ae)
        {
            System.out.println(clntRep + "An exception of class " + ae.getClass().getName() +

                " occurred while communicating with the ATM");

            ae.printStackTrace();

        }

    }

}
